<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

	<head>
		<style type="text/css">
			.ui-datepicker{font-size:10px} 
		</style>
	</head>
    <h:body>
		<ui:composition template="/admin/template.xhtml">		    			
		<p:panel header="Rozhodčí a delegáti">	
			<h:panelGrid columns="2">
				<p:panel header="Editace rozhodčích" style="min-height: 1000px;">   
				   <h:form id="form">	
					    	<p:dataTable id="playerTable" var="player" widgetVar="playersTable" value="#{refereeBean.refereeList}"  paginatorAlwaysVisible="false" paginatorPosition="bottom"  paginator="true" rows="14" rowKey="#{player.id}"  selection="#{refereeBean.selectedReferee}" selectionMode="single"  filteredValue="#{refereeBean.filteredReferees}" emptyMessage="Žádný hráč nenalezen" tableStyle="min-width:300px;">
						        <f:facet name="header">
									<p:outputPanel>  
					            	      <h:outputText value="Hledat rozhodčího: " />  
					           		   	  <p:inputText id="globalFilter" onkeyup="playersTable.filter()" style="width:150px" />  
					           		 </p:outputPanel>  
						        </f:facet>
						        <p:column headerText="Jméno" filterBy="#{player.firstname}" filterStyle="display:none">  
						            <h:outputText value="#{player.firstname}" />  
						        </p:column>
						        <p:column headerText="Příjmení" filterBy="#{player.surname}" filterStyle="display:none">  
						            <h:outputText value="#{player.surname}" />  
						        </p:column>					        						        
						        <f:facet name="footer">  
					            	<p:commandButton icon="ui-icon-pencil" value="editace" update=":dialog" oncomplete="competionDialog.show()"/>
					                <p:commandButton icon="ui-icon-document" value="nový"  oncomplete="competionNewDialog.show()"/>       
					       		</f:facet>     
					  	    </p:dataTable>
					</h:form>
					<p:dialog id="dialog" header="Editace rozhodčího" widgetVar="competionDialog" resizable="false"  
					              width="300" showEffect="clip" hideEffect="fold">  
						      	 <h:form>   
						      	    <h:panelGrid id="display" columns="2" cellpadding="4">
						      	       <h:outputText value="Jméno:" />    						      
							           <h:inputText value="#{refereeBean.selectedReferee.firstname}" style="width:150px"/>  
						      	       <h:outputText value="Příjmení:" />    						      
							           <h:inputText value="#{refereeBean.selectedReferee.surname}" style="width:150px"/>    						      							             							             	 
						        	</h:panelGrid> 
						        	<p:commandButton value="Ulož změny"  actionListener="#{refereeBean.updateReferee}" update=":form,:growl" oncomplete="competionDialog.hide()"/> 
						        </h:form>	
					 </p:dialog>
				     <p:dialog id="dialogNew" header="Nový rozhodčí" widgetVar="competionNewDialog" resizable="false"  
					              width="300" showEffect="clip" hideEffect="fold">  
						      	 <h:form>   
						      	    <h:panelGrid id="display" columns="2" cellpadding="4">
						      	       <h:outputText value="Jméno:" />    						      
							           <h:inputText value="#{refereeBean.newReferee.firstname}" style="width:150px"/>  
						      	       <h:outputText value="Příjmení:" />    						      
							           <h:inputText value="#{refereeBean.newReferee.surname}" style="width:150px"/> 
						        	</h:panelGrid> 
						        	<p:commandButton value="Uložit rozhodčího"  actionListener="#{refereeBean.createReferee}" update=":form,:dialogNew,:growl" oncomplete="competionNewDialog.hide()"/> 
						        </h:form>	
					</p:dialog>
				</p:panel>

				<p:panel header="Editace delegátů" style="min-height: 500px;">   
				   <h:form id="form1">	
					    	<p:dataTable id="playerTable" var="player" widgetVar="playersTable" value="#{delegatBean.delegatList}"  paginatorAlwaysVisible="false" paginatorPosition="bottom"  paginator="true" rows="14" rowKey="#{player.id}"  selection="#{delegatBean.selectedDelegat}" selectionMode="single"  filteredValue="#{refereeBean.filteredDelegats}" emptyMessage="Žádný hráč nenalezen" tableStyle="min-width:300px;">
						        <f:facet name="header">
									<p:outputPanel>  
					            	      <h:outputText value="Hledat delegáta: " />  
					           		   	  <p:inputText id="globalFilter" onkeyup="playersTable.filter()" style="width:150px" />  
					           		 </p:outputPanel>  
						        </f:facet>
						        <p:column headerText="Jméno" filterBy="#{player.firstname}" filterStyle="display:none">  
						            <h:outputText value="#{player.firstname}" />  
						        </p:column>
						        <p:column headerText="Příjmení" filterBy="#{player.surname}" filterStyle="display:none">  
						            <h:outputText value="#{player.surname}" />  
						        </p:column>					        						        
						        <f:facet name="footer">  
					            	<p:commandButton icon="ui-icon-pencil" value="editace" update=":dialog1" oncomplete="competionDialog1.show()"/>
					                <p:commandButton icon="ui-icon-document" value="nový"  oncomplete="competionNewDialog1.show()"/>       
					       		</f:facet>     
					  	    </p:dataTable>
					</h:form>
					<p:dialog id="dialog1" header="Editace delegáta" widgetVar="competionDialog1" resizable="false"  
					              width="300" showEffect="clip" hideEffect="fold">  
						      	 <h:form>   
						      	    <h:panelGrid id="display" columns="2" cellpadding="4">
						      	       <h:outputText value="Jméno:" />    						      
							           <h:inputText value="#{delegatBean.selectedDelegat.firstname}" style="width:150px"/>  
						      	       <h:outputText value="Příjmení:" />    						      
							           <h:inputText value="#{delegatBean.selectedDelegat.surname}" style="width:150px"/>    						      							             							             	 
						        	</h:panelGrid> 
						        	<p:commandButton value="Ulož změny"  actionListener="#{delegatBean.updateDelegat}" update=":form1,:growl" oncomplete="competionDialog1.hide()"/> 
						        </h:form>	
					 </p:dialog>
				     <p:dialog id="dialogNew1" header="Nový delegát" widgetVar="competionNewDialog1" resizable="false"  
					              width="300" showEffect="clip" hideEffect="fold">  
						      	 <h:form>   
						      	    <h:panelGrid id="display" columns="2" cellpadding="4">
						      	       <h:outputText value="Jméno:" />    						      
							           <h:inputText value="#{delegatBean.newDelegat.firstname}" style="width:150px"/>  
						      	       <h:outputText value="Příjmení:" />    						      
							           <h:inputText value="#{delegatBean.newDelegat.surname}" style="width:150px"/> 
						        	</h:panelGrid> 
						        	<p:commandButton value="Uložit delegáta"  actionListener="#{delegatBean.createDelegat}" update=":form1,:dialogNew1,:growl" oncomplete="competionNewDialog1.hide()"/> 
						        </h:form>	
					</p:dialog>
				</p:panel>				
			</h:panelGrid>
		</p:panel>			
		</ui:composition>	
	</h:body>
</html>